package view;

import java.awt.BorderLayout;
import java.awt.event.ActionEvent;
import java.awt.event.ActionListener;
import java.awt.event.WindowEvent;
import java.awt.event.WindowListener;

import javax.swing.JFrame;
import javax.swing.Timer;

public class SimpleGame extends JFrame implements WindowListener {
	private Map cfpanel;
	private JFrame frame;

	public SimpleGame() {
		frame = this;
		setTitle("Catch fish Game Coffee Java");
		setLayout(new BorderLayout());
		setSize(800, 600);
		cfpanel = new Map();

		getContentPane().add(cfpanel, BorderLayout.CENTER);
		setVisible(true);
		this.setDefaultCloseOperation(JFrame.DO_NOTHING_ON_CLOSE);
		this.addWindowListener(this);
	}

	public static void main(String[] args) {
		new SimpleGame();
	}

	@Override
	public void windowActivated(WindowEvent e) {

	}

	@Override
	public void windowClosed(WindowEvent e) {
	}

	@Override
	public void windowClosing(WindowEvent e) {
		if (cfpanel.getIsStart()) {
//			 frame.dispose();
			cfpanel.pause();
			NotifyExit n = new NotifyExit();
		} else {
			System.exit(EXIT_ON_CLOSE);
		}
		
//		close();
	}

	@Override
	public void windowDeactivated(WindowEvent e) {
	}

	@Override
	public void windowDeiconified(WindowEvent e) {
	}

	@Override
	public void windowIconified(WindowEvent e) {

	}

	@Override
	public void windowOpened(WindowEvent e) {

	}
}
